package sort;

import java.util.Stack;

public class SortWithoutList implements InterfaceSort {
	public Stack<String> mStack = new Stack<String>();

	public void add(String str) {
		mStack.add(str);
		return;
	}

	public void add(int pos, String str) {
		mStack.add(pos, str);
		return;
	}

	public void remove(String str) {
		int idx = mStack.indexOf(str);
		if (idx != -1)
			mStack.remove(idx);
		// System.out.println(str + "'s idx : " + idx);
		return;
	}

	@Override
	public void remove(int pos) {
		mStack.remove(pos);
	}

	@Override
	public void clear() {
		mStack.clear();
	}

	public void printAll() {
		System.out
				.println("=====================================================================");
		System.out.println(mStack.toString());
		System.out
				.println("=====================================================================");
	}
}